Spread ASP.NET 17
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / ListBase<T> Class / BinarySearch Method / BinarySearch(Int32,Int32,T,IComparer<T>) Method
The zero-based starting index of the range to search.
The length of the range to search.
The object to locate. The value can be null for reference types.
The IComparer implementation to use when comparing elements.


In This Topic
    BinarySearch(Int32,Int32,T,IComparer<T>) Method
    In This Topic
    Searches the entire sorted ListBase<T> for an element using the default comparer and returns the zero-based index of the element.
    Syntax
    'Declaration
     
    
    Public Overloads Function BinarySearch( _
       ByVal index As Integer, _
       ByVal count As Integer, _
       ByVal item As T, _
       ByVal comparer As IComparer(Of T) _
    ) As Integer
    'Usage
     
    
    Dim instance As ListBase(Of T)
    Dim index As Integer
    Dim count As Integer
    Dim item As T
    Dim comparer As IComparer(Of T)
    Dim value As Integer
     
    value = instance.BinarySearch(index, count, item, comparer)
    public int BinarySearch( 
       int index,
       int count,
       T item,
       IComparer<T> comparer
    )

    Parameters

    index
    The zero-based starting index of the range to search.
    count
    The length of the range to search.
    item
    The object to locate. The value can be null for reference types.
    comparer
    The IComparer implementation to use when comparing elements.

    Return Value

    The zero-based index of item in the sorted ListBase<T>, if item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, the bitwise complement of ListBase<T>.Count.
    See Also